package test;
import static org.junit.Assert.*;
import smartKiwi.*;
import org.junit.Before;
import org.junit.Test;


public class testRequetes {

	SmartKiwiRequest req;
	final String sampleText = "{\"idFiche\":\"0\",\"idRepertoire\":\"0\",\"type\":\"2\",\"date\":\"11/04/2015\",\"content\":\"Message au sujet du Projet ICE\"}";
	final String sampleDoc = "{\"idFiche\":\"5\",\"idRepertoire\":\"0\",\"content\":\"/9j/4AAQSkZJRgABAQEAlgCWAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCACzAIcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD02e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aQH5iPSmI22Rx6tSO4VyM8mqGh+7uaN4NRZJNP4xSHYduBPSjNMB4zRmkMf8AjSZFMLUhYCgB5bFPSQHAqszimxzbm+lAmhL1dkoZf4utQhw4yO/ardydyKR1yKzpcxSFl6E8ikCHtTDQXDYxTScnrTGB9qjORTicCml/loAn05yb+MH3/kaKr6WzHV4snj5uPwNFMhnReUhOdvOc9aQwRsclefqaKKBCiJB0FHlJ6frRRQO4eUn939aPKT0/WiigLieTGf4f1o8iL+7+poooC4htoSMFP1NItpAvRMfiaKKBXHmGMjBX9aiNjbHOY85/2jRRQA0adaL0i/8AHj/jS/2fa/8APL/x4/40UUDuH9nWv/PL/wAeP+NIdNsz/wAsf/Hj/jRRQF2EWnWkEwmji2uvQ7if60UUUCP/2Q==\"}";
	@Before
	public void setUp() throws Exception {
		req = new SmartKiwiRequest("http://109.26.75.165:8080/projetice/rest/contextuel/","admin","admin");
	}

	@Test
	public void testLogin() {
		assertFalse("Login Failed", req.login() < 0);
	}
	
	@Test
	public void testGetFiches() {
		assertFalse("GetFiches failed",req.getFiches() == null);
	}
	
	@Test
	public void testgetRepertoiresOfFiche() {
		assertFalse("GetFiches failed",req.getRepertoiresOfFiche(4) == null);
	}
	
	@Test
	public void testEnvoyerTexte() {
		assertFalse("EnvoyerTexte failed",req.envoyerTexte(sampleText) == false);
	}
	
	@Test
	public void testEnvoyerDocument() {
		assertFalse("EnvoyerDoc failed",req.envoyerDocument(sampleText) == false);
	}
	

}
